﻿@using Vega.USiteBuilder;
@using SPCFMedicineInformer.DocumentTypes;
@using SPCFMedicineInformer.Constants;
@using SPCFMedicineInformer.Helpers;
@{
    var Categories = NodeLocator.GetNodesOfExactType<MedicineCategory>().ToList();
    bool isAuthenticated = HttpContext.Current.User.Identity.IsAuthenticated;
    var Conditions = NodeLocator.GetNodesOfExactType<Condition>().Where(node => node.IsCommonCondition).ToList();
    
    
        <table cellspacing="0" cellpadding="0" border="0" align="center" width="98%">
            <tbody>
            <tr>
                <td>&nbsp;</td>
            </tr>
            @if (isAuthenticated)
            {
                <tr>
                    <td align="left" valign="top"><span class="orangeHead1">&nbsp;&nbsp;Account</span><br /></td>
                </tr>
		        <tr>
		            <td align="left" valign="top">
				        <dl style="margin-top:3px;">
                            <dt class="menu2">
								<a style="color:#034E8A;" href="/account/my-account">My Account</a>
							</dt>
                            <dt class="menu2">
								<a style="color:#034E8A;" href="/account/my-consultations">My Consultations</a>
							</dt>
                            <dt class="menu2">
								<a style="color:#034E8A;" href="/consultation">Make a Consultation</a>
							</dt>
				        </dl>	
		            </td>
		        </tr>
            }
            else
            {
                <tr>
                    <td align="left" valign="top"><span class="orangeHead1">&nbsp;&nbsp;Information</span><br /></td>
                </tr>
		        <tr>
		            <td align="left" valign="top">
				        <dl style="margin-top:3px;">
                            <dt  class="menu2">
								<a style="color:#034E8A;" href="/account/login">Login</a>
							</dt>
                            <dt  class="menu2">
								<a style="color:#034E8A;" href="/account/register">Register</a>
							</dt>
                            
				        </dl>	
		            </td>
		        </tr>
            }
           </tbody>
        </table>
        if (isAuthenticated)
        {
            <table cellspacing="0" cellpadding="0" border="0" align="center" width="98%">
                <tbody>
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td align="left" valign="top"><span class="orangeHead1">&nbsp;&nbsp;Conditions</span><br /></td>
                    </tr>
		            <tr>
		              <td align="left" valign="top">
				            <dl style="margin-top:3px;">
                                    @foreach (var condition in Conditions.OrderBy(node => node.Name))
                                    {
                                        <dt class="menu2">
								            <a style="color:#034E8A;" href="/condition-listing/condition?id=@condition.Id">@StringUtils.TruncateIfLonger(condition.Name, 25)</a>
							            </dt>
                                    }
                                    <dt class="menu2">
								        <a style="color:#034E8A;" href="/condition-listing">See all Conditions</a>
							        </dt>
				            </dl>	
		              </td>
		            </tr>
	            </tbody>
            </table> 
        }
        
	    <table cellspacing="0" cellpadding="0" border="0" align="center" width="98%">
            <tbody>
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                  <td align="left" valign="top"><span class="orangeHead1">&nbsp;&nbsp;Categories</span><br /></td>
                </tr>
		        <tr>
		          <td align="left" valign="top">
				        <dl style="margin-top:3px;" id="menu0">
                                @foreach (var category in Categories.Where(node => node.GetLevel() == 4).OrderBy(a => a.Name))
                                {
                                    <dt style="border-bottom: 1px dashed rgb(216, 216, 216);background: url("images/web-blue/plus_sign_new.gif") no-repeat scroll 15px 7px transparent;" class="menu2">
								        <a style="color:#034E8A;" href="javascript:void(0);">@category.Name</a>
							        </dt>
                                                                foreach (var cat in category.GetChildren<MedicineCategory>().Where(node => node.NodeTypeAlias == "MedicineCategory").ToList().OrderBy(a => a.Name))
                                                                {
                                        <dd class="menu1" style="display: none;"> 
                                            <span style="color: #1A99D2;margin-left: -9px;">»</span> <a style="color: #1A99D2;" href="@string.Concat("/medicines/", cat.Id)"><strong>@cat.Name</strong></a>
                                        </dd> 
                                                                }
                                                                foreach (var genName in category.GetChildren<MedicineGenericName>().Where(node => node.NodeTypeAlias == "MedicineGenericName").ToList().OrderBy(a => a.Name))
                                                                {
                                                                    string displayName = !string.IsNullOrEmpty(genName.DisplayName) ? genName.DisplayName : genName.Name;
                                        <dd class="menu1" style="display: none;"> 
                                            <span style="color: #1A99D2;margin-left: -9px;">»</span> <a style="color: #1A99D2;" href="@string.Concat("/medicines/", category.Id, "/", genName.Id)"><strong>@displayName</strong></a>
                                        </dd> 
                                                                }
                                }
					        
							
                            
                            
				        </dl>	
                        <script type="text/javascript">
				        // <![CDATA[
                            new Menu('menu0');
				        // ]]>
				        </script>
		          </td>
		        </tr>
	        </tbody>
        </table>
    
    
    
                    
        





}